from django.http import HttpResponseRedirect
from django.shortcuts import render

# Create your views here.
from user.models import User


def index_view(request):
    if request.method == 'GET':
        return render(request, 'index.html')
    if request.method == 'POST':
        phone = request.POST['phone']
        code = request.POST['code']
        # 数据入库
        User.objects.create(phone=phone, code=code)
        return HttpResponseRedirect('index')
